<?php

namespace Services\Security;
class SecurityService
{
    const CIPHER_METHOD = "AES-256-CBC";

    const KEY = "57443ba2-a536-4987-9c1e-1c5be456d12a";

    public static function encryptData($data, $iv = '')
    {
        $options = 0;
        $encrypted = openssl_encrypt($data, self::CIPHER_METHOD, self::KEY, $options, $iv);
        return $encrypted;
    }

    public static function decryptData($encryptedData, $iv = '')
    {
        $options = 0;
        $decrypted = openssl_decrypt($encryptedData, self::CIPHER_METHOD, self::KEY, $options, $iv);
        return $decrypted;
    }
}
